/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.account.manage.repository.mapper;

import info.peigen.hotpot.business.account.core.repository.entity.AccountFreezeLogEntity;
import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlManageMapper;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

/**
 * <b>(AccountFreezeLogManageMapper)</b>
 * 管理后台 "账户冻结解冻记录" 数据库映射服务
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2023-08-29
 */
@SuppressWarnings("unused")
public interface AccountFreezeLogManageMapper extends AbstractBeetlSqlManageMapper<AccountFreezeLogEntity> {

    // 索引[account_id]
    @Sql("select * from account_freeze_log where account_id = ?")
    @Select
    AccountFreezeLogEntity findByAccountId(String accountId);

    @Sql("delete from account_freeze_log where account_id = ?")
    @Update
    void deleteByAccountId(String accountId);

    // 索引[trade_id]
    @Sql("select * from account_freeze_log where trade_id = ?")
    @Select
    AccountFreezeLogEntity findByTradeId(String tradeId);

    @Sql("delete from account_freeze_log where trade_id = ?")
    @Update
    void deleteByTradeId(String tradeId);

    // 唯一索引[freeze_type]
    @Sql("select * from account_freeze_log where freeze_type = ?")
    @Select
    AccountFreezeLogEntity findByFreezeType(String freezeType);

    @Sql("select * from account_freeze_log where freeze_type = ? for update")
    @Select
    AccountFreezeLogEntity lockByFreezeType(String freezeType);

    @Sql("delete from account_freeze_log where freeze_type = ?")
    @Update
    void deleteByFreezeType(String freezeType);

    // 索引[bops_operator_id]
    @Sql("select * from account_freeze_log where bops_operator_id = ?")
    @Select
    AccountFreezeLogEntity findByBopsOperatorId(String bopsOperatorId);

    @Sql("delete from account_freeze_log where bops_operator_id = ?")
    @Update
    void deleteByBopsOperatorId(String bopsOperatorId);

    // 索引[partner_id]
    @Sql("select * from account_freeze_log where partner_id = ?")
    @Select
    AccountFreezeLogEntity findByPartnerId(String partnerId);

    @Sql("delete from account_freeze_log where partner_id = ?")
    @Update
    void deleteByPartnerId(String partnerId);
}